<%
String status = "";
if(request.getSession().getAttribute("status") != null){
	status = (String)request.getSession().getAttribute("status");
}else if(!status.equals("ingelogd")){
	response.sendRedirect("index.jsp?message=Log+eerst+in+om+verder+te+gaan");
}

//session.removeAttribute("status");
%>
<%@page import="model.*" %>
<%@page import="domein.*" %>
<%@ page import = "java.util.Date,java.text.SimpleDateFormat,java.text.ParseException"%>
<%String eventNaam =""; String plaats =""; String Titel =""; String contactpersoon =""; String Organisator ="";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Incentro Event Inviting System</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico" />
</head>

<body>

	<div id="wrapper">

		<div id="header">
			<a href="./eOverzicht.jsp" id="logo"><img src="img/logo.png" /></a>
		</div>
		
		<% 
		int eventID = Integer.parseInt(request.getParameter("eventID"));
		EvenementenIO eIO = new EvenementenIO(); 
		LocatieIO lIo = new LocatieIO();
		UitnodigingIO uIo = new UitnodigingIO();
		ProgrammaIO pIo = new ProgrammaIO();
		Evenement e = eIO.getEvent(eventID);
		String adres = lIo.getAdres(e.getLocatieID());
		String plaatsEvent = lIo.getPlaats(e.getLocatieID());
		String startTijd = pIo.getStartTijd(e.getProgrammaID());
		String bnaam = uIo.getBedrijfsnaamLIH(e.getProgrammaID());
		String logoLink = uIo.getLogoLink(bnaam);
		
		
		String datum = e.getDatum();
		Date datumpje = new SimpleDateFormat("yyyy-MM-dd").parse(datum);
		Date huidigeDatum = new Date();

		%>

		<h3>Details - <%out.print(e.getNaam()); %></h3>
		
		<div id="search-form">
		
		<% if(datumpje.compareTo(huidigeDatum)<0) {	%>
			<a href="./Archief.jsp"><input type="submit" value="Terug" class="terugButton" /></a>
		<% } else { %>
			<a href="./eOverzicht.jsp"><input type="submit" value="Terug" class="terugButton" /></a>
		<% } %>
		</div>
		
			<ul id="eDetails">
				<li><label>Adres</label><span><%out.print(adres); %></span></li>
				<li><label>Datum</label><span><%String date = e.getDatum();
				String dateYear = date.substring(0,4);
				String dateMonth = date.substring(5,7);
				String dateDay = date.substring(8,10);
				out.print(dateDay + "-" + dateMonth + "-" + dateYear); %></span></li>
				<li><label>Plaats</label><span><%out.print(plaatsEvent); %></span></li>
				<li><label>Titel</label><span><%out.print(e.getNaam()); %></span></li>
				<li><label>Contactpersoon</label><span><%out.print(e.getContactPersoon()); %></span></li>
				<li id="lastDetail"><label>Organisator</label><span><%out.print(e.getOrganisator()); %></span></li>
			</ul>
			
			<% if(datumpje.compareTo(huidigeDatum)>0) {	%>
				<input type="button" onclick="location.href = 'event/eAanpassen.jsp?eventID=<%out.print(eventID);%>'" value="Aanpassen" id="editButton" />			
			<% } %>
	
	</div>

</body>

</html>